#[[#define cssStyle()]]#
<link href="#[[#(res_path)]]#/hplus/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
#if(autocodeModel.select2)
<link href="#[[#(res_path)]]#/hplus/css/plugins/select2/select2.min.css" rel="stylesheet">
#end
#[[#end]]#
#[[#define content()]]#
<div style="padding:0 10px;height: 100%">
	#if(autocodeModel.search)
	<div id="AdvanceSearch" style="padding:15px;display: none">
		<form class="form-horizontal" novalidate="novalidate" onsubmit="return bootstrapTableRefresh()">
			#for(item:columnList)#if(item.search)
			<div class="form-group">
				<label class="col-xs-3 control-label">#(item.name)：</label>
				<div class="col-xs-8">
					#@searchInput(item)
				</div>
			</div>
	    #end#end
			<div class="form-group">
				<div class="col-xs-8 col-xs-offset-3">
					<button type="reset" class="btn btn-default">清空</button>&nbsp;
					<button type="submit" class="btn btn-primary">开始查询</button>&nbsp;
					#if(autocodeModel.is_export=="T")
					<button type="button" onclick="exportData();" class="btn btn-default">数据导出</button>
					<iframe name="uploadIFRAME" width="1" height="1" style="display:none"></iframe>
					<script>
						function exportData(){
							layer.msg("数据正在导出，请稍候...(单次最多导出50000条)");
							uploadIFRAME.location.href="#(firstLowerCase(model))List?is_ajax=T#if(parent)&#(firstLowerCase(parent.code))_id=#[[#(]]##(firstLowerCase(parent.code))_id)#end&is_export=T&pageSize=50000&"+$("#AdvanceSearch form").serialize();
						}
					</script>
					#end
				</div>
			</div>
		</form>
	</div>
	#end
	<div id="toolbar">
		#if(autocodeModel.full)
		<button onclick="layer.full(layer.open({content: 'addEdit#(model)#if(parent)?#(firstLowerCase(parent.code))_id=#[[#(]]##(firstLowerCase(parent.code))_id)#end',type: 2,title: '新增#(autocodeModel.name)'}));" type="button" class="btn btn-outline btn-default"><i class="glyphicon glyphicon-plus"></i></button>
		#else
		<button onclick="layer.open({area: ['600px', '#(height)px'],content: 'addEdit#(model)#if(parent)?#(firstLowerCase(parent.code))_id=#[[#(]]##(firstLowerCase(parent.code))_id)#end',type: 2,title: '新增#(autocodeModel.name)'});" type="button" class="btn btn-outline btn-default"><i class="glyphicon glyphicon-plus"></i></button>
		#end
	#if(autocodeModel.search)<button onclick="layer.open({area: ['450px', 'auto'],content:$('#AdvanceSearch'),type:1,shade: false,title:'搜索'});" type="button" class="btn btn-outline btn-default"><i class="glyphicon glyphicon-search"></i></button>#end
		<a href="batchDelete#(model)" class="btn btn-outline btn-default" target="selectedTodo" rel="btSelectItem" title="确定删除这些数据？"><i class="glyphicon glyphicon-trash"></i></a>
	</div>
	<table id="bootstrapTable" data-id-field="id" data-url="#(firstLowerCase(model))List#if(parent)?#(firstLowerCase(parent.code))_id=#[[#(]]##(firstLowerCase(parent.code))_id)#end" data-sort-name="id" data-sort-order="desc">
		<thead>
			<tr>
				<th data-checkbox="true"></th>
				<th data-formatter="xuhaoFormatter" data-align="center" data-width="70px">序号</th>
				#for(item:columnList)
				<th data-field="#(item.column)#if(item.change)_cn#end" data-align="center">#(item.name)</th>
				#end
				<th data-field="create_time" data-align="center" data-width="150px">创建时间</th>
				<th data-formatter="caozuoFormatter">操作</th>
			</tr>
		</thead>
	</table>
</div>
#[[#end]]#
#[[#define js()]]#
<script src="#[[#(res_path)]]#/hplus/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="#[[#(res_path)]]#/hplus/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
#if(autocodeModel.datetime)<script src="#[[#(res_path)]]#/hplus/js/plugins/laydate/laydate.js"></script>#end
#if(autocodeModel.select2)
<script src="#[[#(res_path)]]#/hplus/js/plugins/select2/select2.full.min.js"></script>
#end
#[[#end]]#
#[[#define jsFunction()]]#
<script>
	$(function(){
	#if(autocodeModel.select2user)
		$("select[name='#(autocodeModel.select2user)']").select2({
			placeholder:"请输入用户名或姓名搜索",
			ajax: {url: "#[[#(res_path)]]#/portal/auth/select2LoadUserList",dataType: 'json',delay: 250,
			  data: function (params) {
			  	return {keyword: params.term,portal: "PORTAL"};
				},
				processResults: function (data) {return {results: data}},
				cache: true
			}
		});
	#end
	#if(autocodeModel.datetime)
		laydate.render({elem:"input[name='#(object).#(autocodeModel.datetime)']",type:"datetime"});
	#end
	});
	function caozuoFormatter(value,row,index){
		var str = "";
		#if(autocodeModel.full)
			str = str + "<a href=\"javascript:\" onclick=\"layer.full(layer.open({area: ['600px', '#(height)px'],content: 'addEdit#(model)?id="+row.id+"',type: 2,title: '编辑#(autocodeModel.name)'}));\">编辑</a>&nbsp;&nbsp;";
		#else
			str = str + "<a href=\"javascript:\" onclick=\"layer.open({area: ['600px', '#(height)px'],content: 'addEdit#(model)?id="+row.id+"',type: 2,title: '编辑#(autocodeModel.name)'});\">编辑</a>&nbsp;&nbsp;";
		#end
		#if(child)str = str + "<a href=\"javascript:\" onclick=\"layer.full(layer.open({area: ['600px', '300px'],content: '#(firstLowerCase(child.code))List?#(firstLowerCase(model))_id="+row.id+"',type: 2,title: '#(child.name)列表'}));\">#(child.name)列表</a>&nbsp;&nbsp;";#end
		return str;
	}
</script>
#[[#end]]#